<template>
  <div class="box">
    <h2>Son2子组件</h2>
    从vuex中获取数据：<span>{{count}}</span><br />
    <button @click="handleJian">值-1</button>
    <hr>
    <p>测试访问模块中的getters  原生写法</p>
    <p>{{ $store.getters['user/UpperCaseName'] }}</p>
    <hr>

  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: 'Son2Com',
  computed: {
    ...mapState(['count'])
  },
  methods: {
    handleJian () {
      this.$store.commit('optCount', ['-', 1])
    }
  }
}
</script>

<style scoped>
.box {
  width: 300px;

  border: 1px solid red;
}
</style>
